We are experiencing some strange behavior on the kflop (433L). There is a touch probing routine which is invoked with M100. The routine performs some linear moves using a roughly coordinated movement of 3 linear axes (the start_move() function below). Then there is a loop which checks for completion of the move.
What we are seeing is that there is the occasional delay in the move_done() loop, which lasts well beyond the time the axes appear to complete the move. For example, in our probing routine the typical move is about 20mm, which normally takes about 0.5 sec. The delays occur about 1 time in 10, and the additional delay time ranges from 0 to about 6 seconds. It is not that CheckDone() is taking a long time to return, but it is reporting "not done" for some time after the move has actually completed.
Our system has 3 threads running at this point: a background supervisor, the probing routine itself, and another thread which is used to launch the probe and wait for the result. By counting the number of loops, it can be verified that the loop period is 360us, as expected, so I don't think it is anything else in our code which is blocking the CPU etc. Basically, the code works and returns the correct results, but the extra delays are annoying. My colleague speculates that the machine is "thinking about doing something naughty" :-)
Do you have any insight into why this would be happening? Regards, SJH
This is a somewhat simplified outline of the code...
/* Start a "coordinated" move. */ int start_move(double x, double y, double z, double vel, int rel) { double dx = rel ? x : x - chan[0].Position; double dy = rel ? y : y - chan[1].Position; double dz = rel ? z : z - chan[2].Position; double r = sqrt(dx*dx+dy*dy+dz*dz); if (rel) { x += chan[0].Position; y += chan[1].Position; z += chan[2].Position; } vel /= r; MoveAtVel(0, x, vel*fast_fabs(dx)); MoveAtVel(1, y, vel*fast_fabs(dy)); MoveAtVel(2, z, vel*fast_fabs(dz)); return 0; }
int move_done(void) { return CheckDone(1) && CheckDone(2) && CheckDone(0); }
...
while (!move_done()) { WaitNextTimeSlice(); }
|
|